/*
 *    Copyright (c) 2018-2025, nart All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: nart
 */

package com.nai365.nart.order.entity;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * 订单
 *
 * @author baogs
 * @date 2022-07-01 14:19:39
 */
@Data
@TableName("oms_order")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "订单")
public class Order extends Model<Order> {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value="id")
    private Long id;

    /**
     * member_id
     */
    @ApiModelProperty(value="member_id")
    private Long memberId;
    /**
     * 商品所有人id
     */
    @ApiModelProperty(value="商品所有人id")
    private Long ownId;

    /**
     * 订单号
     */
    @ApiModelProperty(value="订单号")
    private String orderSn;

    /**
     * 使用的优惠券
     */
    @ApiModelProperty(value="使用的优惠券")
    private Long couponId;

    /**
     * create_time
     */
    @ApiModelProperty(value="create_time")
    private LocalDateTime createTime;

    /**
     * 用户名
     */
    @ApiModelProperty(value="用户名")
    private String memberUsername;

    /**
     * 订单总额
     */
    @ApiModelProperty(value="订单总额")
    private BigDecimal totalAmount;

    /**
     * 应付总额
     */
    @ApiModelProperty(value="应付总额")
    private BigDecimal payAmount;

    /**
     * 促销优化金额（促销价、满减、阶梯价）
     */
    @ApiModelProperty(value="促销优化金额（促销价、满减、阶梯价）")
    private BigDecimal promotionAmount;

    /**
     * 积分抵扣金额
     */
    @ApiModelProperty(value="积分抵扣金额")
    private BigDecimal integrationAmount;

    /**
     * 优惠券抵扣金额
     */
    @ApiModelProperty(value="优惠券抵扣金额")
    private BigDecimal couponAmount;

    /**
     * 后台调整订单使用的折扣金额
     */
    @ApiModelProperty(value="后台调整订单使用的折扣金额")
    private BigDecimal discountAmount;

    /**
     * 支付方式【1->支付宝；2->微信；3->银联； 4->连连；5->余额支付;】
     */
    @ApiModelProperty(value="支付方式【1->支付宝；2->微信；3->银联； 4->连连；5->余额支付;】")
    private Integer payType;

    /**
     * 订单来源[0->PC订单；1->app订单]
     */
    @ApiModelProperty(value="订单来源[0->PC订单；1->app订单]")
    private Integer sourceType;

    /**
     * 订单状态【0->待付款；1->待发货；2->已发货；3->已完成；4->已关闭；5->无效订单】
     */
    @ApiModelProperty(value="订单状态【0->待付款；1->待发货；2->已发货；3->已完成；4->已关闭；5->无效订单】")
    private Integer status;

    /**
     * 自动确认时间（天）
     */
    @ApiModelProperty(value="自动确认时间（天）")
    private Integer autoConfirmDay;

    /**
     * 可以获得的积分
     */
    @ApiModelProperty(value="可以获得的积分")
    private Integer integration;

    /**
     * 可以获得的成长值
     */
    @ApiModelProperty(value="可以获得的成长值")
    private Integer growth;

    /**
     * 订单备注
     */
    @ApiModelProperty(value="订单备注")
    private String note;

    /**
     * 确认收货状态[0->未确认；1->已确认]
     */
    @ApiModelProperty(value="确认收货状态[0->未确认；1->已确认]")
    private Integer confirmStatus;

    /**
     * 删除状态【0->未删除；1->已删除】
     */
    @ApiModelProperty(value="删除状态【0->未删除；1->已删除】")
    private Integer deleteStatus;
    /**
     * 订单类型（1优先购 2抢购 3抽签 4充值 5提现6二级市场）
     */
    @ApiModelProperty(value="订单类型（1优先购 2抢购 3抽签 4充值 5提现 6二级市场）")
    private Integer orderType;
    /**
     * 数据id
     */
    @ApiModelProperty(value="数据id")
    private Long dataId;

    /**
     * 下单时使用的积分
     */
    @ApiModelProperty(value="下单时使用的积分")
    private Integer useIntegration;

    /**
     * 支付时间
     */
    @ApiModelProperty(value="支付时间")
    private LocalDateTime paymentTime;

    /**
     * 发货时间
     */
    @ApiModelProperty(value="发货时间")
    private LocalDateTime deliveryTime;

    /**
     * 确认收货时间
     */
    @ApiModelProperty(value="确认收货时间")
    private LocalDateTime receiveTime;

    /**
     * 评价时间
     */
    @ApiModelProperty(value="评价时间")
    private LocalDateTime commentTime;

    /**
     * 修改时间
     */
    @ApiModelProperty(value="修改时间")
    private LocalDateTime modifyTime;


	@TableField(exist = false)
	private List<OrderItem> orderItemEntityList;

	/**
	 * 0为买入，1为卖出
	 */
	@TableField(exist = false)
	private  Integer type;

	@TableField(exist = false)
	@ApiModelProperty(value = "会员信息")
	private Map<String, String> memberInfo;
	@TableField(exist = false)
	@ApiModelProperty(value = "owner信息")
	private Map<String, String> ownerInfo;


}
